package com.itgone.common;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

@Getter
@Setter
public class R<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    private long code;
    private T data;
    private String msg;

    public static <T> R<T> failed(String msg) {
        R<T> tr = new R<>();
        tr.code = -1;
        tr.msg = msg;
        return tr;
    }

    public static <T> R<T> ok(T data) {
        R<T> tr = new R<>();
        tr.code = 0;
        tr.data = data;
        return tr;
    }
}
